/**
* @file   Player.h
* @brief  Header file for class Player
* @date   2011-04-04 10:39:20
* @author Yanze Lian
* @email  <yanzel@gmail.com>
*/

#ifndef Player_H
#define Player_H

#include <DShow.h>
#include "CDXGraph.h"
#include "RecvMessageDlg.h"

enum MSG_TYPE 
{
	COMPLETE,
	USERABORT,
	ERRORABORT
};

typedef void (*RecvDsMessage)(void* pVoid, MSG_TYPE msg_type);

class Player
{
public:
	Player(void* pParent, RecvDsMessage fRecvDsMessage);
	virtual ~Player();

	bool OpenWithoutTitle(CString fileName, HWND hWndDisplay);
	bool Open(CString fileName, HWND hWndDisplay);
	bool Save(CString fileName, CString destFileName);

	void Play();
	void Pause();
	void Stop();

	void Close();

	IMediaEventEx* GetEventHandle();
	void SetCurrentPosition(double inPosition);
	void ProcessPlayerMessage(WPARAM inWParam, LPARAM inLParam);

	void SetScoreFont();
	void ChangeScore(CString strScore);

	bool SnapshotBitmap(CString outFile);

	double GetCurrentPlayTime();

private:

	void* m_pParent;
	CDXGraph* m_filterGraph;
	CRecvMessageDlg* m_recvMessageDlg;
	RecvDsMessage m_fRecvDsMessage;

	void OnRecvMessage(MSG_TYPE msg_type);
};



#endif //Player_H
